package com.dingding.dubbo.framework;

import java.util.List;
import java.util.Random;

/**
 * @program: spring-learning
 * @description:
 * @author: liugongding
 * @create: 2022-02-15 17:55
 **/
public class LoadBalance {

    /**
     * 随机选择一个服务节点
     * @param list
     * @return
     */
    public static URL random(List<URL> list) {
        Random random = new Random();
        int n = random.nextInt(list.size());
        return list.get(n);
    }
}
